package learn.socket_02_threadpool;

import org.eclipse.jetty.util.BlockingArrayQueue;

import java.util.concurrent.*;

/**
 * @author ZhangQi
 */
public class TimeServerHandlerExecutePool {

    private ExecutorService executorService;

    public TimeServerHandlerExecutePool(int maxPool,int queueSize){
        executorService=new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(),maxPool,
                120L, TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(queueSize));
    }

    public void execute(Runnable task){
        executorService.execute(task);
    }
}

